package cn.canxin.core.service;

import cn.canxin.core.bean.Teacher.*;
import cn.canxin.core.dao.teacher.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * Created by Administrator on 2017/5/9.
 */
@Service
@Transactional
public class TeacherBaseInfoServiceImpl implements TeacherBaseInfoService{

    @Resource
    TeacherBaseInfoDao teacherBaseInfoDao;
    @Resource
    TeacherExperienceInfoDao teacherExperienceInfoDao;
    @Resource
    TeacherPictureDao teacherPictureDao;
    @Resource
    TeacherSubjcetInfoDao teacherSubjcetInfoDao;
    @Resource
    TeacherTeachingTimeInfoDao teacherTeachingTimeInfoDao;

    public TeacherBaseInfo getTeacherBaseInfoById(String id) {
        TeacherBaseInfo teacherBaseInfo = new TeacherBaseInfo();
        teacherBaseInfo.setId(id);
        List<TeacherBaseInfo> l = teacherBaseInfoDao.getTeacherBaseInfo(teacherBaseInfo);
        if (l.size() != 0)
        {
            return l.get(0);
        }
        return null;
    }

    public String addTeacherBaseInfo(TeacherBaseInfo teacherBaseInfo) {
        teacherBaseInfo.setCreateDate(new Date());
        teacherBaseInfo.setStatus("0");
        teacherBaseInfoDao.addTeacherBaseInfo(teacherBaseInfo);
        return null;
    }

    public List getTeacherBaseInfoList() {
        TeacherBaseInfo teacherBaseInfo = new TeacherBaseInfo();
        return  teacherBaseInfoDao.getTeacherBaseInfo(teacherBaseInfo);
    }

    public void updateTeacherBaseInfo(TeacherBaseInfo teacherBaseInfo) {
        teacherBaseInfoDao.updateTeacherBaseInfo(teacherBaseInfo);
    }

    public TeacherExperienceInfo getTeacherExperienceInfo(String id) {
        TeacherExperienceInfo teacherExperienceInfo = new TeacherExperienceInfo();
        teacherExperienceInfo.setId(id);
        List<TeacherExperienceInfo> l = teacherExperienceInfoDao.getTeacherExperienceInfo(teacherExperienceInfo);
        if (l.size() != 0)
        {
            return l.get(0);
        }
        return null;
    }

    public List getTeacherExperienceInfoList() {
        TeacherExperienceInfo teacherExperienceInfo = new TeacherExperienceInfo();
        return teacherExperienceInfoDao.getTeacherExperienceInfo(teacherExperienceInfo);
    }

    public String addTeacherExperienceInfo(TeacherExperienceInfo teacherExperienceInfo) {
        teacherExperienceInfo.setCreateate(new Date());
        teacherExperienceInfo.setStatus("0");
        return null;
    }

    public void updateTeacherExperiencInfo(TeacherExperienceInfo teacherExperienceInfo) {
         teacherExperienceInfoDao.updateTeacherExperienceInfo(teacherExperienceInfo);
    }

    public TeacherPicture getTeacherPicture(String id) {
        TeacherPicture teacherPicture = new TeacherPicture();
        teacherPicture.setId(id);
        List<TeacherPicture> l = teacherPictureDao.getTeacherPicture(teacherPicture);
        if (l.size() != 0)
        {
            return l.get(0);
        }
        return null;
    }

    public List getTeacherPictureList() {
        TeacherPicture teacherPicture = new TeacherPicture();
        return teacherPictureDao.getTeacherPicture(teacherPicture);
    }

    public String addTeacherPicture(TeacherPicture teacherPicture) {
        teacherPictureDao.addTeacherPicture(teacherPicture);
        return null;
    }

    public void updateTeacherPicture(TeacherPicture teacherPicture) {
        teacherPictureDao.updateTeacherPicture(teacherPicture);
    }

    public TeacherSubjectInfo getTeacherSubjectInfo(String id) {
        TeacherSubjectInfo teacherSubjectInfo = new TeacherSubjectInfo();
        teacherSubjectInfo.setId(id);
        teacherSubjectInfo.setCreateDate(new Date());
        teacherSubjectInfo.setStatus("0");
        return null;
    }

    public List getTeacherSubjectInfoList() {
        TeacherSubjectInfo teacherSubjectInfo = new TeacherSubjectInfo();
        return teacherSubjcetInfoDao.getTeacherSubjectInfo(teacherSubjectInfo);
    }

    public String addTeacherSubjectInfo(TeacherSubjectInfo teacherSubjectInfo) {
        teacherSubjectInfo.setCreateDate(new Date());
        teacherSubjectInfo.setStatus("0");
        teacherSubjcetInfoDao.addTeacherSubjectInfo(teacherSubjectInfo);
        return null;
    }

    public void updateTeacherSubjectInfo(TeacherSubjectInfo teacherSubjectInfo) {
        teacherSubjcetInfoDao.updateTeacherSubjectInfo(teacherSubjectInfo);
    }

    public TeacherTeachingTimeInfo getTeacherTeachingTimeInfo(String id) {
        TeacherTeachingTimeInfo teacherTeachingTimeInfo = new TeacherTeachingTimeInfo();
        teacherTeachingTimeInfo.setId(id);
        List<TeacherTeachingTimeInfo> l =teacherTeachingTimeInfoDao.getTeacherTeachingTimeInfo(teacherTeachingTimeInfo);
        if (l.size() != 0)
        {
            return l.get(0);
        }
        return null;
    }

    public List getTeacherTeachingTimeInfoList() {
        TeacherTeachingTimeInfo teacherTeachingTimeInfo = new TeacherTeachingTimeInfo();
        return teacherTeachingTimeInfoDao.getTeacherTeachingTimeInfo(teacherTeachingTimeInfo);
    }

    public String addTeacherTeachingTimeInfo(TeacherTeachingTimeInfo teacherTeachingTimeInfo) {
        teacherTeachingTimeInfo.setCreateDate(new Date());
        teacherTeachingTimeInfo.setStatus("0");
        teacherTeachingTimeInfoDao.addTeacherTeachingTimeInfo(teacherTeachingTimeInfo);
        return null;
    }

    public void updateTeacherTeachingTimeInfo(TeacherTeachingTimeInfo teacherTeachingTimeInfo) {
        teacherTeachingTimeInfoDao.updateTeacherTeachingTimeInfo(teacherTeachingTimeInfo);
    }
}
